<?php
	require_once 'init.php';
	if ( $_SERVER["REQUEST_METHOD"] == "POST" )
	{
		$usernc = $_SESSION['unc'];
		$password = $util->quotes($_POST["password"]);
		$confirmpassword = $util->quotes($_POST["confirmpassword"]);
		if ($usernc != "" && $password != "" && $password != $confirmpassword) {			
			//Update Password
			if (isset($password) && $password != ''){
				$sql = "update ".$util->userdbName().".tbUser set fdPassword=md5('".trim($password)."') where fdLogin='".$usernc."'";
				$adminDB->executeSQL($sql, $connID);
			}
			
			echo "<script>alert('用户密码更改成功！');window.location.href='usercenter.php';</script>";	
		}
		else
		{
			echo "<script>alert('用户密码有误，请确认两次输入的密码一致！');window.location.href='userpassword.php';</script>";	
		}
	}
?>